import xadmin
from apps.operations.models import UserAsk, CourseComments, UserFavorite, UserMessage, RelUserCourse


class UserAskAdmin(object):
    list_display = ['id', 'name', 'mobile', 'course_name']
    list_filter = ['mobile']
    search_fields = ['name', 'course_name']
    list_per_page = 15


xadmin.site.register(UserAsk, UserAskAdmin)


class CourseCommentsAdmin(object):
    list_display = ['id', 'user', 'course', 'comments']
    search_fields = ['comments']
    list_per_page = 15


xadmin.site.register(CourseComments, CourseCommentsAdmin)


class UserFavoriteAdmin(object):
    list_display = ['id', 'user', 'fav_id', 'type']
    list_per_page = 15


xadmin.site.register(UserFavorite, UserFavoriteAdmin)


class UserMessageAdmin(object):
    list_display = ['id', 'content', 'user', 'has_read']
    list_filter = ['has_read']
    search_fields = ['content']
    list_per_page = 15


xadmin.site.register(UserMessage, UserMessageAdmin)


class RelUserCourseAdmin(object):
    list_display = ['id', 'user', 'course']
    list_per_page = 15


xadmin.site.register(RelUserCourse, RelUserCourseAdmin)
